package com.jason.www.state_pattern.demo1.state;


import com.jason.www.state_pattern.demo1.context.RoomContext;

/**
 * 房间被预定状态
 */
public class RoomBookedState implements IRoomState {
    private RoomContext context;

    public RoomBookedState(RoomContext context) {
        this.context = context;
    }

    @Override
    public void bookRoom() {
        //不需要做操作
    }

    @Override
    public void unsubscribeRoom() {
        System.out.println("您已经成功退订了...");
        context.setState(context.getFreeTimeState());
    }

    @Override
    public void checkInRoom() {
        System.out.println("您已经成功入住了...");
        context.setState(context.getChechInState());
    }

    @Override
    public void checkOutRoom() {
        //不需要做操作
        throw new RuntimeException("不需要做操作，执行退房操作失败");
    }
}
